package zhishuang.wang.sansi.playlist.entry;

/**
 * @Author Zhishuang.Wang
 * @Date 2023/7/5 11:10
 * @Email 1406110602@qq.com
 */

import zhishuang.wang.sansi.tools.ReturnData;

public class PlayTimeBase {
    private Integer totalTime;
    private Integer playNum;
    private Integer stopTime;

    public PlayTimeBase(int totalTime, int playNum, int stopTime) {
        this.totalTime = totalTime;
        this.playNum = playNum;
        this.stopTime = stopTime;
    }

    public PlayTimeBase(int totalTime) {
        this.totalTime = totalTime;
    }

    public PlayTimeBase(int playNum, int stopTime) {
        this.playNum = playNum;
        this.stopTime = stopTime;
    }

    public ReturnData checkParam() {
        ReturnData rd = new ReturnData();
        rd.setCode(1);
        String errorMes = "";
        if (this.totalTime == null && this.playNum == null && this.stopTime == null) {
            errorMes = errorMes + "播放时间相关参数必须填写；";
        } else if (this.totalTime == null && this.playNum == null && this.stopTime == null) {
            errorMes = errorMes + "无播放总时间时，播放次数和停留时间必填；";
        }

        if (errorMes != null && errorMes.length() != 0) {
            rd.setMessage(errorMes);
        } else {
            rd.setCode(0);
        }

        return rd;
    }

    public Integer getTotalTime() {
        return this.totalTime;
    }

    public void setTotalTime(Integer totalTime) {
        this.totalTime = totalTime;
    }

    public Integer getPlayNum() {
        return this.playNum;
    }

    public void setPlayNum(Integer playNum) {
        this.playNum = playNum;
    }

    public Integer getStopTime() {
        return this.stopTime;
    }

    public void setStopTime(Integer stopTime) {
        this.stopTime = stopTime;
    }
}
